JavaScript for .NET Developers by Ovais Mehboob Ahmed Khan
Author: Ovais Mehboob Ahmed Khan [Khan, Ovais Mehboob Ahmed] , Date: February 29, 2020
, Views: 85
In the preceding code, first we imported the RouteConfig and ROUTER_DIRECTIVES from angular2/router and then defined the RouteConfig for page 1 and page 2. In the inline template, we placed the anchor tag and defined the route name for page 2. When the application runs, page 1 is set as a default page on a root path /, so the page 1 content will be displayed in place of the router outlet. When the user clicks on the Page2 link, the page 2 content will be rendered in the same place.
Here is the code of page1.component.ts:
//page1.component.ts import {Component} from 'angular2/core'; @Component({ template:'<h1>Page1 Content</h1>' }) export class Page1Component { }
Copyright Disclaimer:
This site does not store any files on its server. We only index and link
to content provided by other sites. Please contact the content providers
to delete copyright contents if any and email us, we'll remove relevant
links or contents immediately.